import { defineStore } from "pinia";
import { ref, computed } from "vue";

interface IUserInfo {
    id: number;
    name: string;
    age: number;
}

const useUserStore = defineStore("user", () => {
    const token = ref<string>("");
    const userInfo = ref<IUserInfo>();
    const isLogin = computed(() => {
        return token.value != "";
    });

    const loginAction = ()=>{
        console.log("login");
        if(200){
            
        }
    }



    // 只有return中的数据才有响应式
    return {
        token,
        userInfo,
        isLogin,
        loginAction,
    };
})

export default useUserStore;